package com.demo.interceptor;

import lombok.extern.slf4j.Slf4j;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;

@Slf4j
public class HeaderInterceptor implements Interceptor {


  @Override
  public Response intercept(Chain chain) throws IOException {
    Request request = chain.request();

    // 添加请求头
    request = request.newBuilder()
        .addHeader("api_key", "fedc1b02ea6d373692449dc4e582eb0d8c423a1198cece07eaf4bd7217abf47e")
        .addHeader("X-Frankie-CustomerID", "94493eb4-b482-c046-12db-445b1188d067")
        .build();
    return chain.proceed(request);
  }


}
